<!--
 * @Description:
 * @Autor: zhangbing
 * @Date: 2021-07-27 17:07:07
 * @LastEditors: zhangbing
 * @LastEditTime: 2021-07-28 00:37:49
-->
<template>
  <div class="container">
        <cons-card :name="tomorrowData.name" :allIndex="tomorrowData.all"> </cons-card>
        <cons-list :data="tomorrowData"></cons-list>
  </div>
</template>

<script>
import { computed, onMounted, ref, onActivated} from "vue";
import { useStore } from "vuex";
import getData from "@/services";

import ConsList from '@/components/List/Tomorrow'

export default {
  name: "TomorrowPage",
  components: {
    ConsList,
  },
  setup() {
    const store = useStore();
    const state = store.state;
    const status = ref('');

    onMounted(() => {
      getData(store);
      status.value = state.consName
      // getData('金牛座', 'week');
    });

    onActivated(() => {
      if (status.value !== state.consName) {
        getData(store);
        status.value = state.consName;
      }
    })

    return {
      tomorrowData: computed(() => state.tomorrow)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
